package com.zretc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class InterceptorTest {
    @RequestMapping("/demo02")
    @ResponseBody
    public String demo02(String name,int age) {
        return "欢迎您" + name;
    }

    @RequestMapping("/demo01")
    public ModelAndView demo01(ModelAndView modelAndView) {
        System.out.println("目标资源执行");
        modelAndView.addObject("user", "张三");
        modelAndView.setViewName("index1");
        return modelAndView;
    }
}
